/*
** my_strcapitalize.c for my_strcapitalize in /home/goupil_r//afs/Jour_06
** 
** Made by robin goupil
** Login   <goupil_r@epitech.net>
** 
** Started on  Mon Oct  8 12:33:20 2012 robin goupil
** Last update Wed Oct 10 08:29:05 2012 robin goupil
*/

char	*my_strcapitalize(char *str)
{
  int	i;

  i = 0;
  while (str[i] != '\0')
    {
      if (str[i] >= 'a' && str[i] <= 'z')
	{
	  if (i == 0 || ((str[i - 1] < '0' || str[i - 1] > '9')
			 && (str[i - 1] < 'a' || str [i - 1] > 'z')
			 && (str[i - 1] < 'A' || str[i - 1] > 'Z')))
	    {
		str[i] = str[i] - 32;
	    }
	}
      else if (str[i] >= 'A' && str[i] <= 'Z')
	{
	  if (str[i - 1] != ' ')
	    str[i] = str[i] + 32;
	}
      i = i + 1;
    }
  return (str);
}
